home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Interfaces & Libraries / Interfaces / CIncludes / GXEnvironment.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-06  |  10.3 KB  |  304 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        GXEnvironment.h
  3.  
  4.      Contains:    QuickDraw GX environment constants and interfaces
  5.  
  6.      Version:    Technology:    Quickdraw GX 1.1
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __GXENVIRONMENT__
  21. #define __GXENVIRONMENT__
  22.  
  23.  
  24. #ifndef __CONDITIONALMACROS__
  25. #include <ConditionalMacros.h>
  26. #endif
  27.  
  28. #ifndef __MIXEDMODE__
  29. #include <MixedMode.h>
  30. #endif
  31. /*    #include <Types.h>                                            */
  32.  
  33. #ifndef __WINDOWS__
  34. #include <Windows.h>
  35. #endif
  36. /*    #include <Memory.h>                                            */
  37. /*    #include <Quickdraw.h>                                        */
  38. /*        #include <QuickdrawText.h>                                */
  39. /*    #include <Events.h>                                            */
  40. /*        #include <OSUtils.h>                                    */
  41. /*    #include <Controls.h>                                        */
  42. /*        #include <Menus.h>                                        */
  43.  
  44. #ifndef __GXTYPES__
  45. #include <GXTypes.h>
  46. #endif
  47. /*    #include <GXMath.h>                                            */
  48. /*        #include <FixMath.h>                                    */
  49.  
  50. #ifndef __CMAPPLICATION__
  51. #include <CMApplication.h>
  52. #endif
  53. /*    #include <Files.h>                                            */
  54. /*        #include <Finder.h>                                        */
  55. /*    #include <Printing.h>                                        */
  56. /*        #include <Errors.h>                                        */
  57. /*        #include <Dialogs.h>                                    */
  58. /*            #include <TextEdit.h>                                */
  59. /*    #include <CMICCProfile.h>                                    */
  60.  
  61. #ifdef __cplusplus
  62. extern "C" {
  63. #endif
  64.  
  65. #if PRAGMA_ALIGN_SUPPORTED
  66. #pragma options align=mac68k
  67. #endif
  68.  
  69. #if PRAGMA_IMPORT_SUPPORTED
  70. #pragma import on
  71. #endif
  72.  
  73. #if defined(__MWERKS__) && GENERATING68K
  74.     #pragma push
  75.     #pragma pointers_in_D0
  76. #endif
  77.  
  78. #define graphicsMacintoshIncludes
  79. /* old header = graphics macintosh */
  80.  
  81.  
  82. enum {
  83.     defaultPollingHandlerFlags    = 0x00,
  84.     okToSwitchDuringPollFlag    = 0x00,
  85.     dontSwitchDuringPollFlag    = 0x01
  86. };
  87.  
  88. typedef long gxPollingHandlerFlags;
  89.  
  90. typedef void (*gxPollingHandlerProcPtr)(long reference, gxPollingHandlerFlags flags);
  91.  
  92. #if GENERATINGCFM
  93. typedef UniversalProcPtr gxPollingHandlerUPP;
  94. #else
  95. typedef gxPollingHandlerProcPtr gxPollingHandlerUPP;
  96. #endif
  97.  
  98. enum {
  99.     uppgxPollingHandlerProcInfo = kCStackBased
  100.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long)))
  101.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(gxPollingHandlerFlags)))
  102. };
  103.  
  104. #if GENERATINGCFM
  105. #define NewgxPollingHandlerProc(userRoutine)        \
  106.         (gxPollingHandlerUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppgxPollingHandlerProcInfo, GetCurrentArchitecture())
  107. #else
  108. #define NewgxPollingHandlerProc(userRoutine)        \
  109.         ((gxPollingHandlerUPP) (userRoutine))
  110. #endif
  111.  
  112. #if GENERATINGCFM
  113. #define CallgxPollingHandlerProc(userRoutine, reference, flags)        \
  114.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppgxPollingHandlerProcInfo, (reference), (flags))
  115. #else
  116. #define CallgxPollingHandlerProc(userRoutine, reference, flags)        \
  117.         (*(userRoutine))((reference), (flags))
  118. #endif
  119.  
  120. extern gxPollingHandlerUPP GXGetGraphicsPollingHandler(long *reference)
  121.  THREEWORDINLINE(0x303C, 0x245, 0xA832);
  122. extern void GXSetGraphicsPollingHandler(gxPollingHandlerUPP handler, long reference)
  123.  THREEWORDINLINE(0x303C, 0x246, 0xA832);
  124. #define graphicsToolboxIncludes
  125. /* old header = graphics toolbox */
  126.  
  127. /* QD to QD GX Translator typedefs */
  128.  
  129. enum gxTranslationOptions {
  130.     gxDefaultOptionsTranslation    = 0x0000,
  131.     gxOptimizedTranslation        = 0x0001,
  132.     gxReplaceLineWidthTranslation = 0x0002,
  133.     gxSimpleScalingTranslation    = 0x0004,
  134.     gxSimpleGeometryTranslation    = 0x0008,                        /* implies simple scaling */
  135.     gxSimpleLinesTranslation    = 0x000C,                        /* implies simple geometry & scaling */
  136.     gxLayoutTextTranslation        = 0x0010,                        /* turn on gxLine layout (normally off) */
  137.     gxRasterTargetTranslation    = 0x0020,
  138.     gxPostScriptTargetTranslation = 0x0040,
  139.     gxVectorTargetTranslation    = 0x0080
  140. };
  141.  
  142. typedef long gxTranslationOption;
  143.  
  144.  
  145. enum gxTranslationStatistics {
  146.     gxContainsFormsBegin        = 0x0001,
  147.     gxContainsFormsEnd            = 0x0002,
  148.     gxContainsPostScript        = 0x0004,
  149.     gxContainsEmptyPostScript    = 0x0008
  150. };
  151.  
  152. typedef long gxTranslationStatistic;
  153.  
  154.  
  155. enum {
  156.     gxQuickDrawPictTag            = 'pict'
  157. };
  158.  
  159. struct gxQuickDrawPict {
  160. /* translator inputs */
  161.     gxTranslationOption                options;
  162.     Rect                            srcRect;
  163.     Point                            styleStretch;
  164. /* size of quickdraw picture data */
  165.     unsigned long                    dataLength;
  166. /* file alias */
  167.     struct gxBitmapDataSourceAlias    alias;
  168. };
  169. typedef struct gxQuickDrawPict gxQuickDrawPict;
  170.  
  171. /* WindowRecord utilities */
  172. extern gxViewPort GXNewWindowViewPort(WindowPtr qdWindow)
  173.  THREEWORDINLINE(0x303C, 0x236, 0xA832);
  174. extern gxViewPort GXGetWindowViewPort(WindowPtr qdWindow)
  175.  THREEWORDINLINE(0x303C, 0x237, 0xA832);
  176. extern WindowPtr GXGetViewPortWindow(gxViewPort portOrder)
  177.  THREEWORDINLINE(0x303C, 0x238, 0xA832);
  178. /* GDevice utilities */
  179. extern GDHandle GXGetViewDeviceGDevice(gxViewDevice theDevice)
  180.  THREEWORDINLINE(0x303C, 0x239, 0xA832);
  181. extern gxViewDevice GXGetGDeviceViewDevice(GDHandle qdGDevice)
  182.  THREEWORDINLINE(0x303C, 0x23a, 0xA832);
  183. /* gxPoint utilities */
  184. extern void GXConvertQDPoint(const Point *shortPt, gxViewPort portOrder, gxPoint *fixedPt)
  185.  THREEWORDINLINE(0x303C, 0x23b, 0xA832);
  186. /* printing utilities typedef */
  187. typedef OSErr (*gxShapeSpoolProcPtr)(gxShape toSpool, long refCon);
  188. typedef void (*gxUserViewPortFilterProcPtr)(gxShape toFilter, gxViewPort portOrder, long refCon);
  189. typedef long (*gxConvertQDFontProcPtr)(gxStyle dst, long txFont, long txFace);
  190.  
  191. #if GENERATINGCFM
  192. typedef UniversalProcPtr gxShapeSpoolUPP;
  193. typedef UniversalProcPtr gxUserViewPortFilterUPP;
  194. typedef UniversalProcPtr gxConvertQDFontUPP;
  195. #else
  196. typedef gxShapeSpoolProcPtr gxShapeSpoolUPP;
  197. typedef gxUserViewPortFilterProcPtr gxUserViewPortFilterUPP;
  198. typedef gxConvertQDFontProcPtr gxConvertQDFontUPP;
  199. #endif
  200.  
  201. enum {
  202.     uppgxShapeSpoolProcInfo = kCStackBased
  203.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  204.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(gxShape)))
  205.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long))),
  206.     uppgxUserViewPortFilterProcInfo = kCStackBased
  207.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(gxShape)))
  208.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(gxViewPort)))
  209.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long))),
  210.     uppgxConvertQDFontProcInfo = kCStackBased
  211.          | RESULT_SIZE(SIZE_CODE(sizeof(long)))
  212.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(gxStyle)))
  213.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long)))
  214.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long)))
  215. };
  216.  
  217. #if GENERATINGCFM
  218. #define NewgxShapeSpoolProc(userRoutine)        \
  219.         (gxShapeSpoolUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppgxShapeSpoolProcInfo, GetCurrentArchitecture())
  220. #define NewgxUserViewPortFilterProc(userRoutine)        \
  221.         (gxUserViewPortFilterUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppgxUserViewPortFilterProcInfo, GetCurrentArchitecture())
  222. #define NewgxConvertQDFontProc(userRoutine)        \
  223.         (gxConvertQDFontUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppgxConvertQDFontProcInfo, GetCurrentArchitecture())
  224. #else
  225. #define NewgxShapeSpoolProc(userRoutine)        \
  226.         ((gxShapeSpoolUPP) (userRoutine))
  227. #define NewgxUserViewPortFilterProc(userRoutine)        \
  228.         ((gxUserViewPortFilterUPP) (userRoutine))
  229. #define NewgxConvertQDFontProc(userRoutine)        \
  230.         ((gxConvertQDFontUPP) (userRoutine))
  231. #endif
  232.  
  233. #if GENERATINGCFM
  234. #define CallgxShapeSpoolProc(userRoutine, toSpool, refCon)        \
  235.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppgxShapeSpoolProcInfo, (toSpool), (refCon))
  236. #define CallgxUserViewPortFilterProc(userRoutine, toFilter, portOrder, refCon)        \
  237.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppgxUserViewPortFilterProcInfo, (toFilter), (portOrder), (refCon))
  238. #define CallgxConvertQDFontProc(userRoutine, dst, txFont, txFace)        \
  239.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppgxConvertQDFontProcInfo, (dst), (txFont), (txFace))
  240. #else
  241. #define CallgxShapeSpoolProc(userRoutine, toSpool, refCon)        \
  242.         (*(userRoutine))((toSpool), (refCon))
  243. #define CallgxUserViewPortFilterProc(userRoutine, toFilter, portOrder, refCon)        \
  244.         (*(userRoutine))((toFilter), (portOrder), (refCon))
  245. #define CallgxConvertQDFontProc(userRoutine, dst, txFont, txFace)        \
  246.         (*(userRoutine))((dst), (txFont), (txFace))
  247. #endif
  248.  
  249. typedef gxShapeSpoolProcPtr gxShapeSpoolFunction;
  250.  
  251. typedef gxUserViewPortFilterProcPtr gxUserViewPortFilter;
  252.  
  253. typedef gxConvertQDFontProcPtr gxConvertQDFontFunction;
  254.  
  255. /* mouse utilities */
  256. /* return mouse location in fixed-gxPoint global space */
  257. extern void GXGetGlobalMouse(gxPoint *globalPt)
  258.  THREEWORDINLINE(0x303C, 0x23c, 0xA832);
  259. /* return fixed-gxPoint local mouse (gxViewPort == 0 --> default) */
  260. extern void GXGetViewPortMouse(gxViewPort portOrder, gxPoint *localPt)
  261.  THREEWORDINLINE(0x303C, 0x23d, 0xA832);
  262. /* printing utilities */
  263. extern gxUserViewPortFilter GXGetViewPortFilter(gxViewPort portOrder, long *refCon)
  264.  THREEWORDINLINE(0x303C, 0x25e, 0xA832);
  265. extern void GXSetViewPortFilter(gxViewPort portOrder, gxUserViewPortFilter filter, long refCon)
  266.  THREEWORDINLINE(0x303C, 0x23e, 0xA832);
  267. /* QD to QD GX Translator functions */
  268. extern void GXInstallQDTranslator(GrafPtr port, gxTranslationOption options, const Rect *srcRect, const Rect *dstRect, Point styleStrech, gxShapeSpoolUPP userFunction, void *reference)
  269.  THREEWORDINLINE(0x303C, 0x23f, 0xA832);
  270. extern gxTranslationStatistic GXRemoveQDTranslator(GrafPtr port, gxTranslationStatistic *statistic)
  271.  THREEWORDINLINE(0x303C, 0x240, 0xA832);
  272. extern gxShape GXConvertPICTToShape(PicHandle pict, gxTranslationOption options, const Rect *srcRect, const Rect *dstRect, Point styleStretch, gxShape destination, gxTranslationStatistic *stats)
  273.  THREEWORDINLINE(0x303C, 0x241, 0xA832);
  274. /* Find the best GX style given a QD font and face. Called by the QD->GX translator */
  275. extern long GXConvertQDFont(gxStyle theStyle, long txFont, long txFace)
  276.  THREEWORDINLINE(0x303C, 0x242, 0xA832);
  277. extern gxConvertQDFontUPP GXGetConvertQDFont(void)
  278.  THREEWORDINLINE(0x303C, 0x243, 0xA832);
  279. extern void GXSetConvertQDFont(gxConvertQDFontUPP userFunction)
  280.  THREEWORDINLINE(0x303C, 0x244, 0xA832);
  281. /* ColorSync 2.0 interface related routines */
  282. extern void GXSetColorProfileReference(gxColorProfile profile, CMProfileRef reference)
  283.  THREEWORDINLINE(0x303C, 0x282, 0xA832);
  284. extern CMProfileRef GXGetColorProfileReference(gxColorProfile profile)
  285.  THREEWORDINLINE(0x303C, 0x283, 0xA832);
  286.  
  287. #if defined(__MWERKS__) && GENERATING68K
  288.     #pragma pop
  289. #endif
  290.  
  291. #if PRAGMA_IMPORT_SUPPORTED
  292. #pragma import off
  293. #endif
  294.  
  295. #if PRAGMA_ALIGN_SUPPORTED
  296. #pragma options align=reset
  297. #endif
  298.  
  299. #ifdef __cplusplus
  300. }
  301. #endif
  302.  
  303. #endif /* __GXENVIRONMENT__ */
  304.